package com.ruoyi.merchant.mapper;

import com.ruoyi.common.core.cg.pojo.Community;
import com.ruoyi.common.core.cg.pojo.Leader;
import org.apache.ibatis.annotations.*;
import org.springframework.context.annotation.Primary;

@Mapper
public interface CommunityMapper {
    @Insert(" insert into community (title,leader_id,lat,lng,address,qq_map_id,create_time)\n" +
            "        values (#{title},#{leaderId},#{lat},#{lng},#{address},#{qqMapId},#{createTime})")
    @Options(useGeneratedKeys = true, keyProperty = "id")
    int communitySave(Community community);

    Community selectComByLid(Integer lid);

    //修改操作
    @Update("update community set address=#{address} where leader_id=#{leaderId}")
    int communityUpdate(Community community);

    Community findCommunityByQQmapId(String id);

    Integer findMemberById(Integer id);

    Leader findLeaderById(Integer id);

    //根据qqmapId查询
    @Select("select * from community where qq_map_id=#{qqMapId}")
    Community selectQQMapId(String qqMapId);

    //修改community
    @Update("update community set leader_id=#{leaderId} where qq_map_id=#{qqMapId}")
    int CommunityUpdate(Community community);
}
